package com.gaoyi.crm.db.entity;

import android.os.Parcel;
import android.os.Parcelable;

import androidx.room.Entity;

import com.gaoyi.crm.db.CrmDatabase;

@Entity(tableName = CrmDatabase.TABLE_CATEGORY)
public class Category extends BaseEntity implements Parcelable {
    private String code;
    private String enName;
    private String cnName;
    private int state;
    private boolean def;

    public Category() {
    }

    protected Category(Parcel in) {
        code = in.readString();
        enName = in.readString();
        cnName = in.readString();
        state = in.readInt();
        def = in.readByte() != 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(code);
        dest.writeString(enName);
        dest.writeString(cnName);
        dest.writeInt(state);
        dest.writeByte((byte) (def ? 1 : 0));
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<Category> CREATOR = new Creator<Category>() {
        @Override
        public Category createFromParcel(Parcel in) {
            return new Category(in);
        }

        @Override
        public Category[] newArray(int size) {
            return new Category[size];
        }
    };

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getEnName() {
        return enName;
    }

    public void setEnName(String enName) {
        this.enName = enName;
    }

    public String getCnName() {
        return cnName;
    }

    public void setCnName(String cnName) {
        this.cnName = cnName;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public boolean isDef() {
        return def;
    }

    public void setDef(boolean def) {
        this.def = def;
    }
}
